<?php
/**
 * comment.php
 * 评论功能参数验证类
 * Author: netman
 * DateTime:  2023/9/15 10:28
 */
class Request_Api_V2_Comment extends Request_Api_V2_Base
{
    public function __construct($request_param)
    {
        parent::__construct($request_param);

    }

    public function list()
    {
        $this->rules = [
            ['page', ['not_empty','digit']],
            ['pagesize', ['not_empty','digit']],
            ['type_id', ['not_empty','digit']],
            ['product_id', ['not_empty','digit']]
        ];
        return $this;
    }

    public function stats_info()
    {
        $this->rules = [
            ['type_id', ['not_empty','digit']],
            ['product_id', ['not_empty','digit']]
        ];

        return $this;
    }

    public function add_comment()
    {
        $this->rules = [
            ['product_id', ['not_empty','digit']],
            ['content', ['not_empty']],
            ['order_id', ['not_empty','digit']],
            ['level', ['not_empty','digit']],
            ['type_id', ['not_empty','digit']]
        ];
        //自定义规则
        $this->validation->rule('mid',array('Rule_Member','need_member'));
        return $this;
    }

    public function add_article_comment()
    {
        $this->rules = [
            ['content', ['not_empty']],
            ['article_id', ['not_empty','digit']],
            ['captcha_key', ['not_empty']],
            ['type_id', ['not_empty','digit']],
            ['checkcode', ['not_empty']]
        ];

        return $this;
    }

}